JavaScript

$e.onloaded Function

Syntax

$e.onloaded = function

Description

An optional function that is called after the HTML page has been fully loaded.

Discussion

$e.onloaded is an optionally defined function that will be called after the page has been fully loaded, and the "$e" object has been fully initialized. This function can only be used once on a page. This function is useful if you want to execute some Javascript when a page is loaded, if that Javascript is dependent on the "$e" object being fully initialized.

For example, assume that you have a page with an auto-suggest input control. The auto-suggest control is instantiated using the "A5.AutoSuggest()" function. Assume that when the page is loaded, you want initial focus to go to this control. Assume that the control has an ID of "SUGGEST1". You might be tempted to put the following code in the BODY tag's "onload" attribute. For example:

$('SUGGEST1').focus();

However, this will not work because the "A5.AutoSuggest()" function which initializes the auto-suggest control has not yet executed. The auto-suggest control utilizes the "$e" object. We need to wait till the "$e" object has been fully initialized before we can set focus to "SUGGEST1". The "$e.onloaded" function is how we solve the problem.

$e.onloaded = function() {
      $('SUGGEST1').focus();
}